/**
 * 
 */
package org.waddy.framework.app.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;

/**
 * web系统监听器<br>
 * 随web容器启动第一个加载执行，在这里输出系统加载类相关信息
 * @author zhangdapeng
 */
public class SystemListener extends ContextLoaderListener {
	private static final Logger logger = Logger.getLogger(SystemListener.class);

	public SystemListener() {
		// TODO Auto-generated constructor stub
	}
	

	@Override
	public void contextInitialized(ServletContextEvent event) {
		// TODO Auto-generated method stub
		super.contextInitialized(event);
		//logger.info("系统初始化");
		WebApplicationContext webAppContext = getCurrentWebApplicationContext();
		System.out.println("[SystemListener]系统成功加载bean数量：" + webAppContext.getBeanDefinitionCount());
		String[] beanNames = webAppContext.getBeanDefinitionNames();
		System.out.println(ArrayUtils.toString(beanNames));
		ServletContext servletContext = webAppContext.getServletContext();
	}
	
}
